import axios from 'axios'
import { RootThunkAction } from '../../types/store'

// 获取文章列表
export const getAricleList = (id: number = 0): RootThunkAction => {
  return async (dispatch) => {
    const res = await axios.get(
      `http://geek.itheima.net/v1_0/articles?channel_id=${id}&timestamp=${Date.now()}`
    )
    // console.log(res)
    dispatch({ type: 'article/get', payload: res.data.data.results })
  }
}
